package GUI;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import Objects.Score;

public class GameOverPanel extends JPanel implements ActionListener {
	
	private static final long serialVersionUID = 1L;
	private MainFrame frame;
	private Score score;
	private MenuPanel menuPanel;
	//private JButton menuButton;
	
	public GameOverPanel(MainFrame frame, Score score, MenuPanel menuPanel) {
		this.frame = frame;
		this.score = score;
		this.menuPanel = menuPanel;
		setPreferredSize(new Dimension(800,600));
		setVisible(true);
    	setLayout(null);
    	frame.pack();
    	//menuButton = new JButton(new ImageIcon(getClass().getResource("/Sprites/menuRelease.png")));
    	//add(menuButton);
    	//menuButton.setBounds(0, 0, 160,50);
    	//menuButton.addActionListener(this);
	}
	
	public void paintComponent(Graphics g) {  
        super.paintComponents(g);
        g.drawImage(new ImageIcon(getClass().getResource("/Sprites/gameOver.png")).getImage(),0,0,null);
        g.drawImage(new ImageIcon(getClass().getResource("/Sprites/score.png")).getImage(),200,350,null);
        score.drawFinish(g);
        g.drawImage(new ImageIcon(getClass().getResource("/Sprites/thorhit.gif")).getImage(),365,450,null);
       
    }

	public void actionPerformed(ActionEvent e) {
		this.setVisible(false);
		this.menuPanel.setVisible(true);
		this.menuPanel.requestFocus();
		frame.remove(frame.getInvadersPanel());
		
	}

}